package com.demo.mapper;

import com.demo.pojo.Student;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface StudentMapper {

    @Select("SELECT StudentId, Name, age, sex FROM Student")
    List<Student> getAll();

    @Insert("insert into Student(StudentId, Name, age, sex) values (#{studentId},#{name},#{age},#{sex})")
    void createNew(Integer studentId, String name, Integer age, String sex);

    @Delete("delete from Student where StudentId = #{studentId}")
    Boolean deleteOne(Integer studentId);

    @Select("SELECT StudentId, Name, age, sex FROM Student where studentId = #{studentId}")
    Student getOne(Integer studentId);


    void edit(Student student);
}
